package net.wangds.persistence.columnoriented.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import net.wangds.data.impl.IdCreateDisable;
import net.wangds.data.ColumnOrientedDataTypeEnum;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

/**
 * .
 * <p></p>
 *
 * @author 王东石 2020/10/29 15:08.
 */
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@MappedSuperclass
public class ColumnOrientedEntity extends IdCreateDisable {

    /**
     * 行唯一标识.
     */
    @Getter @Setter
    @Column(length = 36)
    private String rowKey;

    /**
     * 字段名.
     */
    @Getter @Setter
    @Column()
    private String field;

    /**
     * 数据类型
     */
    @Getter @Setter
    @Enumerated(EnumType.ORDINAL)
    @Column(length = 4)
    private ColumnOrientedDataTypeEnum dataType;

    /**
     * 文本值.
     * <p>最大255,超过此长度的，请存储在“{@linkplain #midTextVal}”或"{@linkplain #bigTextVal}"字段。</p>
     */
    @Getter @Setter
    @Column()
    private String textVal;
    /**
     * 中等长度文本值.
     * <p>最大2000,超过此长度的，请存储在"{@linkplain #bigTextVal}"字段。</p>
     */
    @Getter @Setter
    @Column(length = 2000)
    private String midTextVal;
    /**
     * 大文本值.
     */
    @Getter @Setter
    @Column(columnDefinition = "LongText")
    private String bigTextVal;
    /**
     * 整型值.
     * <p>最大12位有效数字。</p>
     */
    @Getter @Setter
    @Column(length = 12)
    private int intVal;

    /**
     * 长整型值.
     * <p>最大20位有效数字。</p>
     */
    @Getter @Setter
    @Column(length = 12)
    private long longVal;


    /**
     * 浮点值.
     * <p>精度(14,4)。<br/>
     * 此字段不适合存放金额。金额请选textVal保存或以整型保存最小单位.</p>
     */
    @Getter @Setter
    @Column(length = 14, scale = 4)
    private float decVal;


    /**
     * 双精度浮点值.
     * <p>精度(14,4)。<br/>
     * 此字段不适合存放金额。金额请选textVal保存或以整型保存最小单位.</p>
     */
    @Getter @Setter
    @Column(length = 14, scale = 4)
    private float dblVal;

}
